<?php
namespace app\api\controller;

class Xunfei extends Base
{
    //讯飞语音

    protected $read_appid = '60328d1e';
    protected $read_appkey = '74468b8aa1bca8d51efa2ae5f3bd93bf';

    //讯飞语音识别加密
    public function xunfei()
    {
        $appid = $this->read_appid;
        $ts = time();
        $md5 = md5($appid . $ts);
        $apkey = $this->read_appkey;
        $hmac = hash_hmac('sha1', $md5, $apkey, true);
        $hmac = base64_encode($hmac);
        return $this->toJson(0, '', [
            'appid' => $appid,
            'ts' => $ts,
            'signa' => $hmac,
        ]);
    }

    //保存内容
//    public function
}